/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.client.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 *
 * @author Merijn Zengers
 */
@Entity
@Table(name="SENSOR_METADATA")
public class SensorMetadata implements Serializable, Persistable {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator="SensorMetadataGen")
    @TableGenerator(name="SensorMetadataGen", table="SENSORMETADATA_GEN", pkColumnName="PK",valueColumnName="AID")
    @Column(name = "SENSORMETADATA_ID")
    private long sensorMetadataId;

    @Column(name = "DATEFORMAT")
    private String dateFormat;

    @Column(name = "SENSORHEIGHT")
    private int sensorHeight;

    @Column(name = "NUMBEROFSENSORS")
    private int numberOfSensors;

    @Column(name = "SENSORSPREAD")
    private String sensorSpread;

    @Column(name = "SENSORTYPE")
    private String sensorType;

    @Column(name = "SPECTRALRANGE")
    private String spectralChannels;


    protected SensorMetadata() {
    }

    public SensorMetadata(String dateFormat, int sensorHeight, int numberOfSensors, String sensorSpread, String sensorType, String spectralChannels) {
        this.dateFormat = dateFormat;
        this.sensorHeight = sensorHeight;
        this.numberOfSensors = numberOfSensors;
        this.sensorSpread = sensorSpread;
        this.sensorType = sensorType;
        this.spectralChannels = spectralChannels;

    }

    public long getId() {
        return sensorMetadataId;
    }

    public void setId(long sensorMetadataId) {
        this.sensorMetadataId = sensorMetadataId;
    }

    public String getDateFormat() {
        return dateFormat;
    }

    public void setDateFormat(String dateFormat) {
        this.dateFormat = dateFormat;
    }

    public int getSensorHeight() {
        return sensorHeight;
    }

    public void setSensorHeight(int sensorHeight) {
        this.sensorHeight = sensorHeight;
    }

    public int getNumberOfSensors() {
        return numberOfSensors;
    }

    public void setNumberOfSensors(int numberOfSensors) {
        this.numberOfSensors = numberOfSensors;
    }

    public String getSensorSpread() {
        return sensorSpread;
    }

    public void setSensorSpread(String sensorSpread) {
        this.sensorSpread = sensorSpread;
    }

    public String getSensorType() {
        return sensorType;
    }

    public void setSensorType(String sensorType) {
        this.sensorType = sensorType;
    }

    public String getSpectralChannels() {
        return spectralChannels;
    }

    public void setSpectralChannels(String spectralRange) {
        this.spectralChannels = spectralRange;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final SensorMetadata other = (SensorMetadata) obj;
        if ((this.dateFormat == null) ? (other.dateFormat != null) : !this.dateFormat.equals(other.dateFormat)) {
            return false;
        }
        if (this.sensorHeight != other.sensorHeight) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 11 * hash + (this.dateFormat != null ? this.dateFormat.hashCode() : 0);
        hash = 11 * hash + this.sensorHeight;
        return hash;
    }
}
